/*
 * AppServResponseHandler.h
 *
 *  Created on: Apr 9, 2017
 *      Author: zhangjf
 */

#ifndef SRC_APPSERVRESPONSEHANDLER_H_
#define SRC_APPSERVRESPONSEHANDLER_H_

#include <Poco/Timer.h>
#include <Poco/Runnable.h>
#include <Poco/Net/WebSocket.h>
#include <Poco/Net/StreamSocket.h>

using namespace Poco;
using namespace Poco::Net;

class WebSocketNotificationnHandler : public Runnable
{
public:
	WebSocketNotificationnHandler(WebSocket& ws, StreamSocket& ss)
	: _webSocket(ws)
	, _streamSocket(ss) {}
	virtual ~WebSocketNotificationnHandler() {}

	virtual void run();

private:
	void onTimer(Timer& timer);

	void handleLoginRequest(std::string& strReq, std::string& strResp);
	void handleLogoutRequest(std::string& strReq, std::string& strResp);

	WebSocket& _webSocket;
	StreamSocket& _streamSocket;
};

#endif /* SRC_APPSERVRESPONSEHANDLER_H_ */
